<!DOCTYPE html>
<html lang="en">
<!--header-->
<include file="Public:header"/>
<!--header-->
<section id="main-content">
    <section class="wrapper">
        <h3><i class="fa fa-angle-right"></i>用户转介者修改</h3>
        <!-- BASIC FORM ELELEMNTS -->
        <div class="row mt">
            <div class="col-lg-12">
                <div class="form-panel">
                    <h4 class="mb"><i class="fa fa-angle-right"></i> 用户信息
                        <a class="btn btn-theme btn-default" href="{:U('index')}">返回</a>
                    </h4>
                    <form id="admin" class="form-horizontal style-form" method="post" action="{:U('zhuan_add')}"  enctype="multipart/form-data">
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label" style="font-weight: bold;color: red;font-size: 16px;">被转介用户信息：</label>
                            <div class="col-sm-10">
                                <div>
                                    <hr>
                                    <p>微信头像：<img class="ph-user"  src="{$list.headimgurl}" width="50%" height="50%"  style="cursor:pointer"></p>
                                    <p>微信昵称：{$list.nickname}</p>
                                    <p>用户姓名：{$list.name}</p>
                                    <p>联系电话：{$list.phone}</p>
                                    <p>被转介时间：{$list.create_at|date="Y-m-d H:i:s",###}</p>
                                    <hr>
                                </div>

                            </div>
                        </div>
                        <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label" style="font-weight: bold;color: red;font-size: 16px;">转介用户信息：</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">搜索条件</label>
                            <div class="col-sm-2">
                                <select id="sou_two" name="type" class="form-control">
                                    <option value="1">请选择搜索条件</option>
                                    <option value="2">微信昵称</option>
                                    <option value="3">姓名</option>
                                    <option value="4">电话</option>
                                </select>
                            </div>
                            <div class="col-sm-2">
                                    <input id="sou_one"  type="text"  class="form-control" placeholder="请输入搜索内容">
                            </div>
                            <div class="col-sm-2">
                                <input id="sou_que"  type="button"  class="btn btn-theme" value="搜索" style="width: 50px;float: left;">
                            </div>

                            <div id="sou_three" style="margin-top: 54px;margin-left: 20%"></div>
                        </div>


                        <input type="hidden" id="che" name="bie_zhuan_id" value="{$list.id}">
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label"></label>
                            <div class="col-sm-10">
                                <input  type="button" id="tianjia" class="btn btn-theme" value="保存" style="width: 150px;margin-left: 60px">
                                <input  type="reset" class="btn btn-warning" value="重置" style="width: 150px">
                            </div>
                        </div>
                    </form>
                </div>
            </div><!-- col-lg-12-->
        </div><!-- /row -->
    </section>
</section>
<!--footer-->
<include file="Public:footer"/>
<!--footer-->
<script type="text/javascript" src="__PUBLIC__/ui/lib/layer/2.4/layer.js"></script>
<script>
    //搜索
    $("#sou_que").click(function(){
        var sou_one = $("#sou_one").val();
        var sou_two = $("#sou_two").val();
        if(sou_two == 1 || sou_one == ""){
            layer.open({
                title: '用户转介者修改提示',
                content: "请选择搜索条件,填写搜索内容！！！",
            });
        }else{
            $.ajax({
                type:"post",
                url:"{:U('sou')}",
                data:{sou_one:sou_one,sou_two:sou_two},
                success:function (res) {
                    $('#sou_three').html('');
                    var arr = "";
                    if(res == 1){
                        arr += "<span style='color: red;'>找不到该家服人员</span>"
                    }else{
                        $.each(res,function(i,n){
                            arr += "<div style='width: 550px;margin-top: 5px;margin-bottom: 5px;font-size: 14px;'><input type='radio' name='user_id' value="+n["id"]+"  class='btn btn-theme' style='float: left;width: 30px;height: 30px;'><div style='margin-left: 38px;margin-bottom: 10px;'><span style='width: 200px;display: block;float: left;'>微信昵称："+n["nickname"]+"；</span><br><span style='width: 200px;display: block;float: left;'>姓名："+n["name"]+"；</span><br><span style='width: 250px;display: block;float: left;'>电话："+n["phone"]+"</span></div></div><br>"
                        });
                    }
                    $("#sou_three").append(arr);
                }
            })
        }
    })
    $("#tianjia").click(function () {
        layer.confirm('确认更改该被转介用户的转介者吗？', {
            title: '转介用户更改提示：',
            btn: ['确定'] //可以无限个按钮
        }, function(index, layero){
            $("#admin").submit();
        });
    })
</script>

</body>
</html>
